<template>
	<view class="home-list-item u-f-ac u-f-jsb animated fadeIn fast" 
	hover-class="home-list-hover"
	@tap="clickevent"
	>
		<view class="u-f-ac">
			<view  v-if="item.icon"
			class="item-icon icon iconfont"
			:class="['icon-'+item.icon]"></view>
			{{item.name}}
		</view>
		<view class="jiantou icon iconfont" :class="{'icon-jinru':!item.data}">{{item.data || ''}}</view>
	</view>
</template>

<script>
	export default {
		props:{
			item:Object,
			index:Number
		},
		methods:{
			clickevent(e){
				switch (this.item.clicktype) {
					case 'navigateTo':
					if (this.item.url){
						uni.navigateTo({url: this.item.url})
					}
					break;
					case 'switchTab':
					if (this.item.url){
						uni.switchTab({url: this.item.url})
					}
					break;
					case 'clear':
					uni.showModal({
						title:"提示",
						content: "是否要清除缓存",
						confirmText:"立即清除",
						success: (res) => {
							if (res.confirm) {
								uni.clearStorage();
								uni.showToast({
									title:"清除缓存成功"
								})
							}
						}
					})
					break;
				}
			}
		}
	}
</script>

<style scoped>
 .home-list-item{
	padding: 20upx;
	border-top: 1upx solid #F4F4F4;
	border-bottom: 1upx solid #F4F4F4;
	color: #333333;
}

.item-icon{ 
	margin-right: 10upx;
}

.jiantou{
	color: #CCCCCC;
} 

.home-list-hover{
	background: #f4f4f4;
}
</style>
